﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.models {
    import net.wooga.pets.events.*;
    import net.wooga.pets.views.popups.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import com.adobe.utils.*;

    public class PopupModel extends Actor {

        private var _current:Array;
        private var _queue:Array;
        private var _isSending:Boolean;// = false

        public function PopupModel(){
            this._current = [];
            this._queue = [];
            super();
        }
        public function get hasOpenPopups():Boolean{
            return ((this._current.length > 0));
        }
        public function addToQueue(_arg1:IPopupView):void{
            this._queue.push(_arg1);
        }
        public function getNextinQueue():IPopupView{
            return ((this._queue.length) ? IPopupView(this._queue.shift()) : null);
        }
        public function hasNext():Boolean{
            return ((this._queue.length > 0));
        }
        public function showNextInQueue():void{
            var _local1:IPopupView = this.getNextinQueue();
            if (_local1){
                this.showPopup(_local1);
            };
        }
        public function showPopup(_arg1:IPopupView):void{
            this._current.push(_arg1);
            var _local2:InfoEvent = new InfoEvent(EventConstants.SHOW_POPUP, null, _arg1);
            dispatch(_local2);
        }
        public function closePopup(_arg1:IPopupView):void{
            ArrayUtil.removeValueFromArray(this._current, _arg1);
            var _local2:InfoEvent = new InfoEvent(EventConstants.CLOSE_POPUP, null, _arg1);
            dispatch(_local2);
        }
        public function get isSending():Boolean{
            return (this._isSending);
        }
        public function set isSending(_arg1:Boolean):void{
            this._isSending = _arg1;
        }
        public function isPopupOpen():Boolean{
            return (((this._current) && ((this._current.length > 0))));
        }

    }
}//package net.wooga.pets.models 
